package cn.wuweixiang.springbootdemo.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.util.Objects;

/**
 * ConditionalConfig
 *
 * @author weixiang.wu
 * @date 2018-08-22 15:55
 **/
public class WindowsCondition implements Condition {


	@Override
	public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
		return Objects.requireNonNull(context.getEnvironment().getProperty("os.name")).contains("Windows");
	}
}
